<?php

namespace App\Console\Commands\Mybank;

use App\Kuafu\Mybank\Model\MybankEntryModel;
use App\Kuafu\Mybank\Service\MybankService;
use App\Kuafu\Order\Model\OrderCouponSplitModel;
use App\Kuafu\Order\Model\OrderDetailSplitModel;
use App\Kuafu\Order\Model\OrderDiscountSplitModel;
use App\Kuafu\Order\Model\OrderExternalSplitModel;
use App\Kuafu\Order\Model\OrderPayUnionSplitModel;
use App\Kuafu\Order\Model\OrderSplitModel;
use App\Kuafu\Pay\Model\PayStreamModel;
use App\Kuafu\Shop\Model\Shop;
use App\Kuafu\WaiMai\Model\WaiMaiOrderDetailModel;
use App\Kuafu\WaiMai\Model\WaiMaiOrderIdShopIdMappingModel;
use App\Kuafu\WaiMai\Model\WaiMaiOrderModel;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;

class QueryMerchantBalanceCommand extends Command
{
    protected $signature = 'mybank:query-merchant-balance {merchantNo?}';

    protected $description = '网商获取商户账户的余额';

    public function handle()
    {
        $merchantNo = $this->argument('merchantNo');

        if ($merchantNo) {

            $result = MybankService::getMerchantBalance($merchantNo);

            dd($result);
        } else {
            $list = MybankEntryModel::query()->where('status', 3)->get();

            foreach ($list as $item) {
                $result = MybankService::getMerchantBalance($item['merchantId']);
                dump($item['contactName'] . ':' . $item['merchantId']);
                dump($result);
                dump('-------------------');
            }
        }
    }
}
